package com.ostrich.module_home.discovery.viewholder

import android.view.View
import android.widget.ImageView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CenterCrop
import com.ostrich.module_home.R
import com.ostrich.module_home.discovery.entity.DiscoveryEntity
import com.zhpan.bannerview.holder.ViewHolder

/**
 * @Author : yaotianxue
 * @Time : On 2023/10/30 16:18
 * @Description : CustomBannerViewHolder
 */
class CustomBannerViewHolder:ViewHolder<DiscoveryEntity> {
    override fun getLayoutId(): Int {
        return R.layout.home_item_custom_view
    }

    override fun onBind(itemView: View?, data: DiscoveryEntity?, position: Int, size: Int) {
        val imageView = itemView?.findViewById<ImageView>(R.id.banner_image)
        data?.let {
            if (imageView != null) {
                Glide.with(imageView)
                    .load(data.data.image)
                    .transform(CenterCrop())
                    .into(imageView)
            }

        }
    }
}